#include "Person.h"

Person::Person(){

}

Person::Person(string name, Address &address, Date &birthDate, unsigned int phone){
    setName(name);
    setAdress(address);
    setBirthDate(birthDate);
    setPhone(phone);
}


Person::~Person(){

}


string Person::getName() const{
    return name;
}

//TODO: must not contain numbers nor strange symbols
void Person::setName(string name){
    this->name = name;
}


Address *Person::getAddress() const{
    return address;
}


void Person::setAdress(Address &address){
    this->address = &address;
}


Date *Person::getBirthDate() const{
    return birthDate;
}


void Person::setBirthDate(Date &birthDate){
    this->birthDate = &birthDate;
}

// Must be of 9 digits (all numbers)
unsigned int Person::getPhone() const{
    return phone;
}


void Person::setPhone(unsigned int phone){
    this->phone = phone;
}


string Person::printPerson() {
    stringstream info;

    info << "Name: " << this->getName() << endl <<
            "Birth date: " << this->getBirthDate() << endl <<
            "Phone: " << this->getPhone()  << endl;

    info << this->getAddress().printAddres() << endl;

    return info.str();
}


void Person::newPerson(Person &person) {
    string name;
    Date birthDate;
    unsigned int phone;

    cout << "\nName: ";
    cin >> name;

    cout << "\nBirth Date: ";
    cin >> birthDate;
	
    cout << "\nPhone: ";
    cin >> phone;
	
    cout << "\nAddress: ";
    address->newAddress(*person.getAddress());

    person.setBirthDate(birthDate);
    person.setName(name);
    person.setPhone(phone);
}